﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Profile;

namespace $safeprojectname$.Storage
{
    public class ProfileSessionStorage : ISessionStorage
    {
        #region constructor
        public ProfileSessionStorage(ProfileBase profile)
        {
            Profile = profile as ProjectProfile;
        }
        #endregion constructor

        #region ISessionStorage
        public void Clear()
        {
            Profile.Session.Clear();
        }

        public virtual void Remove(string key)
        {
            if (Profile.Session.ContainsKey(key))
            {
                Profile.Session.Remove(key);
            }
        }

        public virtual object this[string key]
        {
            get
            {
                return Profile.Session.ContainsKey(key)
                    ? Profile.Session[key]
                    : null;
            }
            set { Profile.Session[key] = value; }
        }

        #endregion ISessionStorage

        #region properties
        protected ProjectProfile Profile { get; set; }
        #endregion properties
    }
}